<?php
App::Import('Model', 'TopographicMapReview');
$topographic_map_review = new TopographicMapReview();
echo $this->Session->flash();
?>
<div id="loading" style="display: none;">
    <?php echo $html->image('loading.gif', array('border' => "0", 'align' => 'center')); ?>
</div>
<table id="tabla"  >
    <thead>
        <tr>
            <th>Id</th>
            <th>Observación</th>
            <th>Fecha</th>
            <th colspan="3">Opciones</th>
        </tr>
    </thead>
    <tbody>
        <?php
        foreach ($revisiones as $revision):


            $property_id = $topographic_map_review->TopographicMap->field('TopographicMap.property_id', array('TopographicMap.id' => $revision['TopographicMapReview']['topographic_map_id']));
            $proyect_id = $topographic_map_review->TopographicMap->Property->field('Property.proyect_id', array('Property.id' => $property_id));
            $codigo_proyecto = $topographic_map_review->TopographicMap->Property->Proyect->field('Proyect.codigo', array('Proyect.id' => $proyect_id));
            //$nombreArchivo = $codigo_proyecto . "-RevisionPlanos-" . $revision['TopographicMapReview']['id'] . ".pdf";
            //$rutaArchivo = APP . "webroot" . "/" . "files" . "/" . $codigo_proyecto . "/" . "revision_planos";
            ?>
            <tr>
                <td><?php echo $revision['TopographicMapReview']['id'] ?></td>  
                <td><?php echo $revision['TopographicMapReview']['observacion'] ?></td>
                <td><?php echo $revision['TopographicMapReview']['fecha'] ?></td>
                <td><?php
        $rutaDocumento = "files" . "/" . $codigo_proyecto . "/" . "revision_planos" . "/";
        if (file_exists($rutaDocumento . $codigo_proyecto . "-RevisionPlanos-" . $revision['TopographicMapReview']['id'] . ".pdf")):
                ?>
                        <a href="<?php echo $rutaDocumento . $codigo_proyecto . "-RevisionPlanos-" . $revision['TopographicMapReview']['id'] . ".pdf" ?>" target="_blank" class="actions" >Archivo revisión</a>
                    <?php endif; ?>
                <td><?php echo $ajax->link('Editar', array('controller' => 'TopographicMapReviews', 'action' => 'edit', $revision["TopographicMapReview"]["id"]), array('class' => 'actions', 'update' => 'content', 'complete' => 'cargar()', 'indicator' => 'loading', 'escape' => false)); ?></td>
                <td><?php echo $ajax->link('Eliminar', array('controller' => 'TopographicMapReviews', 'action' => 'delete', $revision["TopographicMapReview"]["id"], $revision['TopographicMapReview']['topographic_map_id']), array('class' => 'actions', 'update' => 'content', 'complete' => 'cargar()', 'indicator' => 'loading', 'escape' => false), '¿Esta seguro que desea eliminar la revisión sobre el plano?'); ?></td>
            </tr>
        <?php endforeach; ?>
    </tbody>
</table>
<br>
<?php echo $ajax->link('Adicionar', array('controller' => 'TopographicMapReviews', 'action' => 'add', $topographic_map_id), array('class' => 'actions', 'update' => 'content', 'complete' => 'cargar()', 'indicator' => 'loading', 'escape' => false)); ?>
<br>
<br>
<br>
<?php
echo $ajax->link($html->image('regresar.gif', array('width' => '30', 'heigth' => '30', 'alt' => 'Regresar', 'title' => 'regresar')), array('controller' => 'TopographicMaps', 'action' => 'index', $property_id), array('update' => 'content', 'complete' => 'cargar()', 'indicator' => 'loading', 'escape' => false));
?>
<br>